package com.sifang.controller;

import com.sifang.domain.Driver;
import com.sifang.domain.PageBean;
import com.sifang.domain.Result;
import com.sifang.service.IDriverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/driver")
public class DriverController {

    @Autowired
    private IDriverService iDriverService;

    //驾驶员详情
    @GetMapping("/detail")
    public Result<Driver> detail(Integer id){
        Driver d = iDriverService.detail(id);
        return Result.success(d);
    }

    //驾驶员分页显示
    @GetMapping
    public Result<PageBean<Driver>> list(Integer pageNum,Integer pageSize){
        PageBean<Driver> pd = iDriverService.list(pageNum,pageSize);
        return Result.success(pd);
    }
}
